UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qyjtOxcEjOz6Fl8jLjCP9MnedhJ9ScZAhMv0LwpR878=' 
WHERE 
  key_id = 'a59908185e46921600a5c2a4e0a68cdd52ff6d3083c47fdb8df6921f33b6d0e1' 
  AND (
    token = 'qyjtOxcEjOz6Fl8jLjCP9MnedhJ9ScZAhMv0LwpR878=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025