UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Apo5jog2muF/m3kpjMh2GKX0XdB10//Lm4DdN16u3Ac=' 
WHERE 
  key_id = '91d8fce8691cbf5a17bb2e8011528adac7cab45c50d682f6929ec350c501ee77' 
  AND (
    token = 'Apo5jog2muF/m3kpjMh2GKX0XdB10//Lm4DdN16u3Ac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036