UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'doxjcFf9JjaUQJjCe06vIhX6yi6SAlWzrYeddlFbok4='
WHERE
key_id = '0e24d99ff077589fcc0c3cc99a97e1ba375ea0648425f1e725ff1c4bb530b500'
AND (
token = 'doxjcFf9JjaUQJjCe06vIhX6yi6SAlWzrYeddlFbok4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)