Disable Buttons Midair

I’m making a 3D parkour platform game, and I have a sprint feature. However, I can toggle sprint mid-air, and I can’t seem to figure out how to fix it. What I’m looking for is a way to disable the sprint button (Left Shift) while in the air, while possibly keeping the speed of the sprint until they land, in case they jumped while sprinting.

This is what I have so far:

		// Add speed through Sprinting
		if (Input.GetButton ("Fire3"))
		{
			movementSpeed = 20;

		}

		// Reduce speed to normal
		if (Input.GetButtonUp ("Fire3"))
		{
			movementSpeed = 10;
		}
			
		//Disable buttons in mid-air
		if (GroundDistance > 0)
		{
			Input.ResetInputAxes ();
		}

	}

	float GroundDistance;
	bool IsGrounded ()
	{
		return Physics.Raycast (transform.position, - Vector3.up, GroundDistance + 0.1f);
	}

Try changing the first if statement to this:

if(Input.GetButtonDown("Fire3") && GroundDistance <= 0)