UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z8L7ayTeB6SOjLE44WkXx0byb9L0BKczqZaYatNTz8c='
WHERE
key_id = '1320bd61f0de28abb27b32e508faeaaea02aac60cdd40904fefb108a6eab76bd'
AND (
token = 'z8L7ayTeB6SOjLE44WkXx0byb9L0BKczqZaYatNTz8c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)