UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fuAHJJEHdL/CZQoeoiNzVaxVQsu4OWyPWKCieAhVWA8='
WHERE
key_id = 'b9b08abdeba788a909080dbe1680d235de7158e3cc5ff74e3e147521a7a64675'
AND (
token = 'fuAHJJEHdL/CZQoeoiNzVaxVQsu4OWyPWKCieAhVWA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)