"One of the best programming skills you can have is knowing when to walk away for awhile." - Oscar Godson
"Sometimes it's better to leave something alone, to pause, and that's very true of programming." - Joyce Wheeler
"Best ergonomics advice is 'stay hydrated'" Michael Feathers
When working in a factory it is pretty easy to see if you are doing work if you are standing by the assembly line and do manual work of some sort - you are probably working.
Many people, even software developers, believe that writing code is what we do.
But I would state that thinking is what we do.
Most software developers have experienced working on a hard problem that they couldn't solve and then suddenly while they were doing some other mundane task, the solution to the problem just showed up.
So if you have a hard problem sitting staring at the computer screen for more than half an hour (give or take...) will not solve the problem.
Getting away from the computer will most likely help you.
I have often left work with an unsolvable problem only to show up the next day and fix it in 5 minutes.
Just to give an anecdote from the real life:
I once worked at a place where we had a strange error that we couldn't quite catch. We worked a long time to figure out what it was and couldn't figure it out.
But one day as I was sitting on the toilet with my phone browsing on the toilet it appeared to me.
I was not trying to solve the problem, I was just browsing the website...
And BTW drinking a lot of water will make sure you don't sit too long staring at the computer screen - especially as you get older.