Use your motivation to firstly eat something healthy and refuel your cells (can be just a handful of nuts).
Then go for a short walk outside or even exercise if you feel like it (can be just 10 mins of walking outside)..
This will prolong your span of motivation and productivity.
Give it a try next time you feel motivated and let me know how it works for you!