UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5c1vUvjRXrFw8X38nC+b0jpxYMUxEyytktH6SCtWf6M=' 
WHERE 
  key_id = '134242b1ac9196da0d13e1977b807cdad575d158a958e6aa4411208263779a1c' 
  AND (
    token = '5c1vUvjRXrFw8X38nC+b0jpxYMUxEyytktH6SCtWf6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036