Yes, you can use a date/time variable to set a point five seconds in the future, then check whether that point is after the current time (I.E. it hasn't been passed yet); Something like
Press Up key and hold for 0,03 seconds and release
Write [Blue] 'Boost on' to log
Set date [~boostTimeout] to [~boostTimeout] plus [5] seconds
Start Loop While : (Keyboard Key 'B' Is Pressed AND [~boostTimeout] Is After Current Date/Time)
End Loop
Press Down key and hold for 0,03 seconds and release
Write [Blue] 'Boost off' to log
If you want a notification when it times out, you can add a condition, E.G.
Press Up key and hold for 0,03 seconds and release
Write [Blue] 'Boost on' to log
Set date [~boostTimeout] to [~boostTimeout] plus [5] seconds
Start Loop While : (Keyboard Key 'B' Is Pressed AND [~boostTimeout] Is After Current Date/Time)
End Loop
Begin Date Compare : [~boostTimeout] Is Before Current Date/Time
Write [Orange] 'Boost timed out' to log
End Condition
Press Down key and hold for 0,03 seconds and release
Write [Blue] 'Boost off' to log