How can I restore my Moto G from a bootloop caused by updating to Lollipop? I updated my Moto G (XT1032) to the new Lollipop (5.0.1, I think).  I left the phone plugged in to let it download and install, and when I came back to it after about a half hour, the phone was displaying the screen with 'Google' and an unlocked padlock on it.  I left it for another 20 minutes or so, but it stayed on the same screen.  I couldn't power it off at all, every time I tried to, the screen would turn off, but then come back on and vibrated once, only to go back to the padlock.

I ended up going through the Flashboot menu and cleared the Cache Partition, but that made no difference.  Also tried a factory reset, but that seemed to make no difference.  Currently, the phone is still sitting at the padlock screen.

The Flashboot menu says that the phone is unlocked, but I have no memory of doing this.  Maybe it's something to do with the update failing?

Just wondering if anyone has some advice on how to proceed with this.
Well, there are two ways to fix this one out:
Requirements:

You need to have a custom recovery (CWM/TWRP) installed
You are going to require Stock firmware zip file for Moto G XT1028, XT1031, XT1032, XT1033 and XT1034 which can be downloaded over here
ADB and Fastboot

Method 1:

Boot your phone into custom recovery mode. Recovery will have adb on by default, so leave recovery as it is.
Connect your phone to your PC and open command prompt and issue the command: cd directory-with-adb.exe-and-fastboot.exe
Now, issue the command: adb devices. If Moto G drivers have installed properly, the phone will show up. If not, get it over here and install it over your device
Now, from recovery wipe /data and media
Open command prompt and execute: adb push rom.zip /sdcard/rom.zip
It will take some time to install the ROM. If you face a not working SIM or WiFi, extract the downloaded ROM zip file and navigate to extracted firmware folder using cmd and issue:


fastboot flash modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn

Method 2:

Extract the downloaded firmware file to a folder.
Download and extract mfastboot and copy its content to the same folder where the extracted firmware files.
Reboot your Moto G into the Bootloader Mode. To do so, turn off your phone and then press and hold the Volume (-) and Power buttons simultaneously for a few seconds.
Connect your phone to your PC via USB cable.
Now, launch a command window from inside the firmware folder (click shift key, right click and select open command window here option).
In the command window, issue the following commands one by one:


mfastboot flash boot boot.img
mfastboot flash recovery recovery.img
mfastboot flash system system.img_sparsechunk.0
mfastboot flash system system.img_sparsechunk.1
mfastboot flash system system.img_sparsechunk.2
mfastboot flash modem NON-HLOS.bin
mfastboot erase modemst1
mfastboot erase modemst2
mfastboot flash fsg fsg.mbn
mfastboot erase cache
mfastboot erase userdata
mfastboot reboot

Note: If firmware includes four system.img_sparsechunk or you do not want to erase the userdata, you can modify the command.
You have now successfully installed a fresh ROM on your Moto G and the phone the phone should work as usual.
Also, depending on which version you are going to and from, you may need to try using the standard fastboot rather than mfastboot.
Source: [GUIDE] Restore softbricked phone after Lollipop update over on the XDA Developers forum, specifically post 1 and post 14.