UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QHUuOav8wQVnOtO0O8//FLPy3SqCVAcg3aWaWHrh02g=' 
WHERE 
  key_id = '71f22e6f7855683e3be8976e98c52f2b1f392211ce7a0d5cf75002eb5cc776e2' 
  AND (
    token = 'QHUuOav8wQVnOtO0O8//FLPy3SqCVAcg3aWaWHrh02g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026