UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2JxkdeS8VQeHjtSgmomcJ7yDmubQ/GhmW6NN07oSAd8=' 
WHERE 
  key_id = '6dca99161f011af437d620040a0d257d9040f0b4519fe77180fb3414492cbf13' 
  AND (
    token = '2JxkdeS8VQeHjtSgmomcJ7yDmubQ/GhmW6NN07oSAd8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032