Off the layout
Locomotives stored on the layout are more likely to get dust trapped in their vital areas. Store them off the layout if they are going to be unused for long periods or move them to the front of the layout for easy maintenance.
If your budget allows then invest in a locomotive storage case, or build one yourself. It will allow locomotives to be stored upright and in dust proof areas, prolonging their operating window before work will need to be done.
Let them see the light
Even if you can’t run them for long periods of time, allowing a locomotive a few circuits of the layout will give you early warning signs that something is going wrong. Catching a problem earlier makes it easier to fix.
Even a toothbrush in warm, slightly soapy water is enough to clean the plastic body work and remove dirt from difficult areas such as grilles. Removing the bodywork from the chassis also allows for closer inspection of the mechanics.
Get the Gear
WD-40 has so many uses and this is true here as well. A quick squirt will remove dirt and moisture. Use the red straw supplied with it to spray more effectively in the chassis to remove impediments you can’t see.