Yes you can. How you do it is the key point you should worry about.
I was in the exact situation once before. As a 1st timer postdoc my supervisor came to me informally to ask whether I could lecture in his place in case he'd go for "trips". Immediately my internal alarms went off. Why did he drag me into a separate room, and why was he smiling so much? Clearly he was pushing beyond limits.
Still, I was quite friendly and open. I asked how did that contribute for my record with the department and project? I wanted certificates per each class given, and beforehand some rough estimation of how many classes to expect and more or less when. I emphasised on how time-consuming the project and writing of papers were sure to be. And I asked whether officially my postdoctoral funding rewarded or at least demanded giving out classes (e.g. how many hours).
He immediately realised the resistance. He said "Well, in case you don't want to help with classes, it's OK", to which I said, "of course I am available, but I must understand the official details before making plans."
In the end, I lectured about 6-8h in total, out of 3 years as a postdoctoral fellow in that lab. Surely it could have been more. My impression is that he was wary of "leaving for trips" and relying on me to cover him up. I bet he wasn't really communicating absences, where talking about official procedures gets a bit unsettling.
Thus, my advice is: don't let others abuse you, but make concessions where you see some clean opportunity for experience or "points" with the department. You do not depend on your supervisor for jobs later -- this is usually a myth and they won't move a finger in any direction.