UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dPO9U3RbooZJZ7xpDKcbaQfnxUGdQ37Urj33w+r0yVI='
WHERE
key_id = '40f8a802b7efe37665fafa9b977cb6fac054a0b24916a57b9e131da4fff1a585'
AND (
token = 'dPO9U3RbooZJZ7xpDKcbaQfnxUGdQ37Urj33w+r0yVI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)