Turn the grinder off immediately – this is the important thing to remember.
Then simply turn the grind several settings coarser and turn the grinder back on and it should start working again
If nothing happens after you have set the grind much coarser, the grinder is mostly probably fitted with an overload switch that has tripped (designed to protect the electric motor from exactly this kind of thing!), so push the overload switch to reset it.
Moral of the story: only change your grinder to a finer setting when it is switched on!