Make a sprint with time respawn

I have this code to my sprint function but when i run and the time is out i don’t know how restart the time and run again the function to sprint. I need to know how to put a loop in this code.

float sprintTime;

if (Input.GetKey(KeyCode.LeftShift))
        {
            sprintTime += 1 / (1 / Time.deltaTime);
        }

        if (Input.GetKeyDown(KeyCode.LeftShift) && sprintTime <= 2f)
        {
            walkSpeed = 5.5f;
        }

        if (Input.GetKeyUp(KeyCode.LeftShift) || sprintTime > 2f)
        {
            walkSpeed = 2.5f;
        }

as I understand it, after sprintTime reaches 2, time runs out. However, time is increasing and not decreasing, so I think this resolves:

 float sprintTime;
 if (Input.GetKey(KeyCode.LeftShift))
     {
         sprintTime += 1 / (1 / Time.deltaTime);
     }

     if (Input.GetKeyDown(KeyCode.LeftShift) && sprintTime <= 2f)
     {
         walkSpeed = 5.5f;
     }

     if (Input.GetKeyUp(KeyCode.LeftShift) || sprintTime > 2f)
     {
         sprintTime = 0f;
         walkSpeed = 2.5f;
     }