UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hSCf66/XXuTkihEMEfWe8caOxkcbEdwc2cMmS0tq5E0='
WHERE
key_id = 'b5a9dcab9ddfe67a86f3cb4f83d0f7e468b670fe055d559b727b5a3b4b36965b'
AND (
token = 'hSCf66/XXuTkihEMEfWe8caOxkcbEdwc2cMmS0tq5E0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)