Note: Unlocking deletes all data. So take backup of all your required data.
Download the Android SDK or the minimal ADB and Fastboot (The latter is recommended).
Install Motorola adb and fastboot drivers.
Power down the phone.
Press down Vol Down button, and press Power down too. Keep them pressed and release Power button followed by Vol down button. This lets you enter the Fastboot mode.
Connect the phone to PC with a cable, enter command prompt (In Win 8+, type cmd in Start screen).
Add fastboot.exe and adb.exe to the path.
In a commmand prompt, enter the following, and copy the required data:
fastboot oem get_unlock_data
Visit the unlocking site.
Sign in using your Google account or Motorola ID.
Paste the string copied earlier, in the field.
Click on ‘Can my device be unlocked?’.
Click on the “REQUEST UNLOCK KEY” button.
Select the ‘I Agree’ option. The unlock key will be delivered to your email.
With your device still connected, in command prompt, type:
fastboot oem unlock KEY
replacing KEY with the actual key you received.
For more, Read this XDA post by Lucas Eugene.