If you can still unscrew the gearbox frim the motor half, you can remove the gears and thread the holes from the inside of the gearbox to then put the m5 grub screws in.
Just leave them shy of surface by 2mm that should be enough to lock the gearbox.
That's how you can get around your welded shafts.