Mystery boxes can appear randomly on any level. This is indicated by a question mark in the lobby. By touching a mystery box it can be opened and will unlock either a new map, character or an outfit. The unlock will be given to a random player of the group. This also means that as long as one of the players in a lobby doesn't have everything unlocked, mystery boxes can appear.
A lobby doesn't need to have more than one player in it for them to spawn. But for every player who joins the chance for mystery boxes to appear is increased. It is also sometimes possible to determine which of the players will receive the reward: When a question mark appears on a level the moment a player joins, the unlock will be for that person.