UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gBuYE0e9DZbxPpaky4yAbV8CWIxRswzXKXyEOm1C9S8='
WHERE
key_id = '27d0e6adb6eedc6acf56ca5d303442777cc90c2f93421a4c5ee07b358af21eb1'
AND (
token = 'gBuYE0e9DZbxPpaky4yAbV8CWIxRswzXKXyEOm1C9S8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)