UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6uQUft8SW4qpMHoQWhApok7eblHrfic1pUzKBqNVZOw='
WHERE
key_id = 'c52f413e425b3f6b2a05ffd136db35cd935117733fe3125976c1778c78150a07'
AND (
token = '6uQUft8SW4qpMHoQWhApok7eblHrfic1pUzKBqNVZOw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)