UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XfHaSnhhSemMOXSWu9RBcM9iwvp8lMr9ZQhkfpDR64g=' 
WHERE 
  key_id = '520ae490f2df5b36855432565a8e8f54a76ff5d112def8f33661c0ca9db4ac87' 
  AND (
    token = 'XfHaSnhhSemMOXSWu9RBcM9iwvp8lMr9ZQhkfpDR64g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026