UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P7Q5tgX5mD4OT6ZtyZg4deX4rRm1v2c/5abOicBQhBw='
WHERE
key_id = '1c22df3ac597a59c18d41e6cc0600f79d02b0e8a419dd4ccfc291efedbc38939'
AND (
token = 'P7Q5tgX5mD4OT6ZtyZg4deX4rRm1v2c/5abOicBQhBw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)