UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BH9AS9M+dDwa8v5AoC15/NSkxws0LrazSkiiwp+oLsk='
WHERE
key_id = '24dca06e4bfe775c383ec1d64c7f95c6528435a637a35182f04a9f0d7aa52671'
AND (
token = 'BH9AS9M+dDwa8v5AoC15/NSkxws0LrazSkiiwp+oLsk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)