You can always send a message to an editor to enquire about the status of your manuscript. But, you need to consider a few basic points.
First, try to assess how the journal operates, for example what time frames are usually met by people submitting work to the journal. Try also to see what is considered the norm in your field (assuming this journal is in that field). Since the way journals operate varies between both fields and amongst the journals themselves, you need to assess what is a reasonable time.
Second, Try to see if you can figure out what this message "with the editor" means. I would interpret it as not having been sent out for review yet. If that is true then it seems like posing a question would be timely. If the message indicates the paper may also be under review or possibly even back after review for the editor to evaluate, then two months is certainly not too long. So, understanding the process stages and how the messages relate to these may help you decide whether a request is timely or not.
Editors, should not mind responding to brief questions of this sort but if it is clear from their point that the request is clearly premature, it will add to the stress. In other words, an assessment from your side of the normal waiting time along with an appropriate question is a good ground for the communication. Such an assessment can be made by asking your peers and others who have submitted to the journal. You can also kindly ask the editor to provide some insights into the time frame of the review process. It is after all not uncommon that authors may be more or less ready to handle revisions at different times and knowing what to expect is therefore useful.