Magdeburg scored three second-half goals on their way to victory over promotion rivals and pre-Matchday 22 leaders Cologne.