I also have a screen lock widget which toggles (that i made) and it
works 100% of the time. All the ones from the market were
inconsistent.
One thing you may consider is anytime a state changes, Android may
try to reset or reinstate some settings. So, if you always want your
keygaurd off, then add Keygaurd Off to all of your Enter and Exit
tasks for all reasonable states (keyboard out, keyboard in, powered,
unplugged, phone idle, incoming call, on boot... whatever you can
think of) that way tasker will overwrite whatever Android OS wants to
do on it's own.
Remember, Tasker has only so much control over the OS. Android OS can
do whatever it wants to overthrow something else running.