Relax... It's not locked. Restart your Mac.
To avoid the possibility of malware in the future, make sure Gatekeeper is enabled.
Open System Preferences > Security & Privacy then select the General tab.
Make sure either Mac App Store or Mac App Store and identified developers is selected. If that area is grayed out, click the padlock icon to proceed.
Press command + option + esc keys together at the same time for about three seconds
When Force Quit window appears, select Safari, if not already.
Press Force Quit button at the bottom of the window.
Wait. Safari will quit.
Hold the shift key down and launch Safari.