UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ITOLFqy4sI7hLPTQlhI6kOOddDr9OGanNC43x2olK4Y='
WHERE
key_id = '2e351684744ebcf3ae52eaa7ff97b53170297b015c066f99aa15a22a034a0d9b'
AND (
token = 'ITOLFqy4sI7hLPTQlhI6kOOddDr9OGanNC43x2olK4Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)