- From Shulchan Aruch Harav 475.28
It seems that it will depend if it is a mitzvah that his body gets benefit from I.e. Matza, moror, and the Korban Paisach
If yes, then he has done the mitzva.
But if it is no pleasure for his body I.e. shma, shofar, lulav (and tefflin) then he has not yoitze the mitzva and it is not called that he did a mitzva (even if he was not forced just that he did not have in mind to do the commandment)
- from Hilchos Talmud Torah 4.3
it seems he might get some reword since he is doing what the Rabbis commanded "to do the mitzva not for its sake" (we know it is a mitzva to listen to the Rabbis for this reason we say a brocho on shabos candles)
PS @MichaBerger referred me to rambam Mishneh Torah »Sefer Madda » Teshuvah - Chapter Three
Anyone who changes his mind about the mitzvoth has performed and regrets the merits [he has earned], saying in his heart: "What value was there in doing them? I wish I hadn't performed them" - loses them all and no merit is preserved for him at all as [Ezekiel 33:12] states "The righteousness of the upright will not save him on the day of his transgression." This only applies to one who regrets his previous [deeds]...
(For commentaries regarding this see this in Hebrew)
From which it seems that even if his body had pleasure if he regrets (at a later time) that he performed the mitzva it is lost.
But it is possible that this only works if it is all the mitzvot that he had performed not only one