UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X7vJfOU3lNAe7guJlPH0NMtiWCb3K5Y1cX7xWOEpuHc='
WHERE
key_id = '10e37f8659d78154f522446fcc16005c56941e3378e4f91114af4b7540cefb7a'
AND (
token = 'X7vJfOU3lNAe7guJlPH0NMtiWCb3K5Y1cX7xWOEpuHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)