UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NM+lYXKz8HV2gzaQa2rYQfuVQrgWEx91Dr4qWH+udFA='
WHERE
key_id = 'ade221726d0875001a80899d0f9d5a6fe97e6194f0ef1adc078821c988e1555b'
AND (
token = 'NM+lYXKz8HV2gzaQa2rYQfuVQrgWEx91Dr4qWH+udFA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)