UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IyLu6vAciiNJYTjzoyWNtnZAk/s+A48JVU+fD8VSNZc='
WHERE
key_id = 'af906450997100e750cb14710e903c9ecb777043b3e600eef6488afb6ee140e9'
AND (
token = 'IyLu6vAciiNJYTjzoyWNtnZAk/s+A48JVU+fD8VSNZc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)