(set: $key to "false")
If a variables is being using representing a boolean True / False (or Yes / No, On / Off, etc) state then you should be using the Boolean true and false literals instead of a String "true" of "false" value.
(set: $key to true)
(set: $key to false)
This then allows you to write more concise expressions within your (if:) macros, like so.
(set: $key to true)
(if: $key)[This text will only appear if the key variable equals true!]
(set: $key to false)
(if: not $key)[This text will only appear if the key variable equals false!]