UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NRscN5+DTzOlztEeF76sVadolJ3m5U5tVNtwD30ibsk='
WHERE
key_id = 'ef376fd5ffe4c274c0e3d111d5dcc48b28d34f2b574f480fa5a4b2a0cf220714'
AND (
token = 'NRscN5+DTzOlztEeF76sVadolJ3m5U5tVNtwD30ibsk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)