Depending on which libretro core you use, when enabling cheats, your setting is probably stored as a core option in /opt/retropie/configs/all/retroarch-core-options.cfg .
Something like this (depending on which core) :
mame_cheats_enable = "enabled"Try to set your, similar, line on "disabled" to disable the cheats.