UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u/uVOYMGAYnqhfP4OrNsZmQKvZutfLMCAnNpYSRz9bQ=' 
WHERE 
  key_id = '504e591a75a8551bd1c37c7d146c3b52bf47023f1acf4e6654068218a29139ec' 
  AND (
    token = 'u/uVOYMGAYnqhfP4OrNsZmQKvZutfLMCAnNpYSRz9bQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028