UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xIX04rW23ztIRYKFqi+9DQgFU2JiSg9MIvjXlsDy6O0='
WHERE
key_id = 'c610e684e2ee2255ca7b8fb36ef475f9482363c1b504d766d79cd4bdaea826ae'
AND (
token = 'xIX04rW23ztIRYKFqi+9DQgFU2JiSg9MIvjXlsDy6O0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)