UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aO95B40vITp3nu2F07XuQaJZkHnIbH0x8Dg7+3t40mk='
WHERE
key_id = 'adca337483a6b46f4a2520da6d709ca1acfb6cadd75fdd3534e79927f69e6f8f'
AND (
token = 'aO95B40vITp3nu2F07XuQaJZkHnIbH0x8Dg7+3t40mk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)