As we get older motivation decreases, and it seems to require explicit effort to get motivated. Motivation derives from anticipation. If there are things about your work that please you, emotional day-dreaming about successfully completing such tasks can help provide motivation.
Clinical depression can be an important factor here. Try consulting with your doctor or a counselor. Ask for an anti-depressant prescription. I know from personal experience that can help.
I disagree. Motivation doesn’t diminish as one gets older, but that which motivates you may. Now retired, I’m very motivated, just on things that interest me. My last few years working, not so much. Accumulated years of bad management, boring projects, continually reinventing the wheel, etc. drains job satisfaction. Sometimes career interests change. Sometimes a new job or company is the answer.
Clinical depression can be an important factor here. Try consulting with your doctor or a counselor. Ask for an anti-depressant prescription. I know from personal experience that can help.
Good luck!