UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'adne6ESmaM2AJNv9Lkbi5egin5yIp2iq3/1gjrkXXKY='
WHERE
key_id = '65e6ae5819294322b76ac6ce4cb4b7c161532ff1ab1e7462255bf4887eb2b69a'
AND (
token = 'adne6ESmaM2AJNv9Lkbi5egin5yIp2iq3/1gjrkXXKY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)