import bge
controller = bge.logic.getCurrentController()
owner = controller.owner
boost = owner["boost"]
if controller.sensors["boost"].positive and controller.sensors["is boostable"].positive:
owner.linVelocityMax = 7
else:
owner.linVelocityMax = 2
requires two sensors:
this does not include counting.
Counting needs a frequent trigger otherwise you count how many times boost was requested, not how long it took. I suggest to add an always sensor with [True Level Triggering]. This way it constantly triggers the controller. The controller is simply an AND controller. There is not need to execute Python all the time.
For better reading this this is placed at a different state. Make sure both states are enabled when starting the game.
Remarks:
I suggest to call the property something like "boost energy" as I guess it should represent some sort of consumed element.
The above system (as you described) is a very easy and simple system assuming t the amount of consumed "boost" is constant. If that is not the case you can indeed create a system that takes away a part of the boost value (immediately reducing the property value) and results in a velocity change. This requires the code to run at each single frame.
I'm not sure if changing the max-velocity can be considered as "boost". The max-velocity applies to all physics calculations inclusive falling.