UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cQMsAFt9oN26POvDg0KejyMrwUNCZnc72mcG7gA4HAY='
WHERE
key_id = 'c9700c50b49007cf8fe2bdabbc4f5252e83a06bde849005937905d26cbc43adb'
AND (
token = 'cQMsAFt9oN26POvDg0KejyMrwUNCZnc72mcG7gA4HAY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)