UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yxO4JtmH1PjCaBKVgbS7P6s3WhDDUN+xGxRq+cl3B10='
WHERE
key_id = '1dcf490ddbe3ed24689086a341f7490d995437827d383a9439605f590ff1641e'
AND (
token = 'yxO4JtmH1PjCaBKVgbS7P6s3WhDDUN+xGxRq+cl3B10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)