I have mentioned before in previous answers that I have a background in direct exchange feeds. I am more on the tech side but have gone through full market cycles in Europe and the US.
Market on Close orders first of all have to be in the order book at least 10 minutes before market close. Some exchanges have this set at 15 minutes.
The execution time of these orders is often after market but really varies by exchange. The earliest I have seen them executed is about 1 minute before close but most start at normal hour closing time. Most exchanges have a grace period for these trades and other wrap up situations where we would get activity from "normal exchange hours" compared to after hours. Most exchanges this last 10-15 minutes. On our servers we have to actually configure for this grace period and an exchange might send a signal one a year or so to change their own times.
Realistically on a normal trading day the MOC orders will get executed almost right at closing. I could actually look at a log from today and see probably most of them executed within a few seconds of close. On a particular heavy day or a day in which the exchange might have a few issues it might happen 5-10 minutes after close.
To go even further every exchange will have their own rules about what order they will execute trades and when they will start MOC orders. Some exchanges don't even have MOC orders. I will leave you with this thought. There are at least 100 large companies getting direct exchange feeds where they get data milliseconds quicker than the average joe. They have servers that try to guess when these MOC orders will execute so that their algorithms can decide if they should buy/sell before/during/after MOC executions. Most of the time their computers are right but there is no exact science to this.