Tasker: How to disable profile while phone is locked
Here is a fairly simple solution that does not require the use of a variable.

You will need to set up two additional profiles and also ensure that you name the profile you created to trigger on your shake context.  To name your existing profile, if you haven't already, long press on the profile and then touch the A on the top bar to name it - let's use 'Google Shake' for this example.  In order to control the status of a profile through a task action it must have a name.

The first new profile you need will trigger on Display Off.  The associated task should set the Profile Status (find this under Tasker in actions) of your Google Shake profile to Off.

The second new profile you need will trigger on Display Unlocked (rather than Display On).  This will ensure that it only runs when the device is actually unlocked rather than the display turning on and remaining on the lock screen.  The associated task should set the Profile Status of your Google Shake profile to On.

That's it!  Test it out.  Note that it may take a second or two for the Google Shake profile to be turned off and on when the two triggers happen so don't shake too quickly after turning the display off and/or unlocking it.