This can be attained near the middle of the tenth level: "Infiltrate the Octan Tower".
Start by drilling the support beam with Emmet followed by a missile from Metal Beard. This will cause an enemy to spawn on the ledge above which should be destroyed using another missile.
At this point an infinite amount of enemies will spawn from the doors to the left of the beam (in groups of 4). Simply stand in front of the doors with Metal Beard and stomp them until you reach 50.
*Note: This was done in Story Mode but it can also be done in Free Play mode.