UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a8SOoR/ZQj+J4/BQamRIk8VcjZeEMlS+sY7dOJzjAo4='
WHERE
key_id = 'f860667aa7b2cdf48bc13e82bd1bd2c20ab8ede4794c0174c5c54ece2a987b4e'
AND (
token = 'a8SOoR/ZQj+J4/BQamRIk8VcjZeEMlS+sY7dOJzjAo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)