timed value increase?

Hello. How can I have it so that a static variable (in this case, a number) is increased, but only for a certain period of time (like a nitrous boost for a car)?

something like if...speed=10; for 2 seconds

Thhanks

After increasing the value, set a function to decrease it back using yield.

speed=10; // for 2 seconds

yield WaitForSeconds (2);

speed = 0;