The settings are stored in
~/Library/Preferences/ByHost/.GlobalPreferences*.plist, but I don't know any way to apply changes to it without logging out and back in. KeyRemap4MacBook has a command line utility that allows disabling and enabling settings, but it doesn't work with PCKeyboardHack.
This only changes the settings for one keyboard and doesn't work if the system language is not English.
tell application "System Preferences"
reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
tell application "System Events" to tell window 1 of process "System Preferences"
click button 1 of tab group 1
tell sheet 1
tell pop up button 4
if value is "⇪ Caps Lock" then
click menu item 2 of menu 1
click menu item 1 of menu 1
click button "OK"
quit application "System Preferences"