There's one significant point that I don't think was picked up in the other answers.
Be mindful of doing something indicates that you should take care to ensure that you do something good, or to be aware of the possibility that you might do something unintended. In other words, what you're mindful of is the outcome. Examples:
- Be mindful of using verbs in your sentences tells you that you should be careful to make sure you include verbs in your sentences.
- Be mindful of upsetting people when you talk about politics in public tells you that you should consider the possibility of upsetting someone if you talk about politics, and be careful not to.
On the other hand, being mindful when speaks about the action you're performing rather than its outcome.
- Be mindful when using verbs in your sentences assumes that you're using verbs in your sentences, and tells you to be careful when doing so. It doesn't specify of what you should be careful.
- Be mindful when talking about politics in public assumes that you will be talking about politics in public, again without specifying why you should be careful.
I am straying into opinion in adding this one last point: I personally think that writing of being mindful when without adding what to be mindful of is almost always poor English, as it doesn't indicate how to be mindful. Except in a very general sense of "being intentionally aware of yourself", mindfulness really requires an "of" to be meaningful.