Use your mobile phone (which is probably near you all the time) and set a 40 minute alarm or timer to get you up and moving every 40 minutes then decide on getting a drink, stretch or letting the cat in or out, as the case may be.
You could place the phone far away from you so you have to get up to get to it when it rings.
You could allow yourself only so much writing time a day or be mindful and spread it out if you spend more than 4 hours and then try to finish within that alloted time.
You could plan your writing around other activities so you have to have a break every so often.
What ever you do, do try and keep moving. Deep vein thrombosis likes an immobile person. Happy writing!