The gemara says that a person should always involve himself in Torah and Mitzvos even she'lo li'shma because it will lead to lishma. In my sefer, Nasiach B'chukecha (pg. 178) I cited the Dibros Moshe (Shabbos He'ara 92) who says that it would seem that something only qualifies she'lo lishma when it is being done for the purpose of a mitzvah, just that there is an ulterior motive it why it is being done. For example if one studies Torah for the purpose of receiving honor that it shelo lishma because their intent is to do the mitzvah of Torah study just that it is for a non-ideal objective. However, when one is so to speak mis'aseik in the doing of a mitzvah, and doesn't intend to even do the mitzvah, it should not even qualify as she'lo lishma and there should be no reward. However, Rav Moshe proves from this gemara of שפל ונשכר being as Tosafos describes a lazy person who abstains from doing work and happens to also not do work on erev shabbos, receives reward of shelo lishma. In this case his abstention from work is not for the intent of even doing a mitzvah, yet it still qualifies as shelo lishma for which he receives a reward.
There is an interesting question regarding שלא לשמה whether it has inherent value, or whether in and of itself is not significant but one receives reward since it will put them on the path of doing it lishma. We can derive from the gemara that even one who abstains from doing melacha out of laziness qualifies as shelo lishma, that the advantage of lo lishma is not inherent, rather just because the routine will eventually lead to lishma. ויש לדחות.