UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nkAs7RBF5dCZfE3dz6+22prWIerGHIYlYPaI7hiFIHk=' 
WHERE 
  key_id = 'f7095d23dede7603d6d3b81f506f39db01883acbf90f02a1affa67d184df8eed' 
  AND (
    token = 'nkAs7RBF5dCZfE3dz6+22prWIerGHIYlYPaI7hiFIHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039