There is a time for everything according to Kohelet. This certainly applies to when it is appropriate to act in a very "holy" way and when it is not.
A case in point is a Halacha brought in the Rambam related to laws connected with when one is allowed to enter the Beit Hamikdash. We are aware that one is not allowed to go when in a state of impurity.
The Rambam brings a case where one inadvertently became טמא when he was already in the Beit Hamikdash. This could happen if someone died and he was under the same roof with the corpse. The Halacha is that this newly defiled individual must get off of Temple grounds immediately without pause.
If he stops for a moment to bow to Hashem, he is punishable with Karet for praying in the Temple in a state of impurity. This is an example where being "frume" at that moment is inappropriate. Interesting Halacha.