Unlike the retreating Soviet troops did most of the time, he is not really driving in his own lane. Nevertheless the withdrawal was relatively well-organised here as well. Despite the logistical challenges involved (including different-width railway tracks in Hungary and in Soviet territory), the Soviet troops were out before the deadline that was set by the Moscow agreement of March 1990 between the Hungarian and the Soviet governments. The one part of the story which did not go so smoothly was the settlement of financial issues. Hungary's first government post the change-of-system from state socialism looked for compensation from the Soviet military for the environmental damage done in and around the large Soviet military bases. The Soviet government entrusted Lt. Gen. Viktor Shilov with conducting negotiations on behalf of the Soviet Union, and he had a simple formula to work with. He demanded compensation from Hungary for the military assets and the buildings left behind by his troops - the same amount the Hungarian government wanted paid. Parallel to this they also put forward their "zero solution," i.e. that the competing compensation claims should cancel out each other. This was a rather typical way for the Soviet Army to settle an affair like this, and the Hungarian government had to give in eventually.
The one major difference from the Afghanistan pull-out is something that may be obvious: for a Soviet soldier to be deployed to Hungary used to be a privilege. Deploying to Afghanistan... it was deploying to a different planet. Consequently, departing must have been quite different as well.
Update: I was called on to provide some more detail, and I will promptly and happily do so, telling what I can right now, without major effort: the Soviet pull-out started already in April 1989, before the Hungarian-Soviet agreement on the subject (in March 1990). By June 19, 1991 some 50 thousand soldiers, 19 thousand civilian employees, and 32 thousand family members of theirs left the country. They took with them 27 thousand technical assets and 560,000 tons of cargo of all kinds of military equipment. The debate about the financial issues was only fully settled by 1992, by the time when the Soviet Union no longer existed, on the occasion of Russian President Boris Yeltsin's visit to Budapest. The historical importance of that visit came from Yeltsin's apology for the 1956 Soviet intervention, however.