Updating modifier keys from the command line takes no effect
It's because values are written as strings not integers. You can see that using:

$ plutil -convert xml1 -o - ~/Library/Preferences/ByHost/.GlobalPreferences.*.plist


&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;com.apple.keyboard.modifiermapping.1452-591-0&lt;/key&gt;
    &lt;array&gt;
        &lt;dict&gt;
            &lt;key&gt;HIDKeyboardModifierMappingDst&lt;/key&gt;
            &lt;string&gt;30064771303&lt;/string&gt;
            &lt;key&gt;HIDKeyboardModifierMappingSrc&lt;/key&gt;
            &lt;string&gt;30064771302&lt;/string&gt;
        &lt;/dict&gt;
        &lt;dict&gt;
            &lt;key&gt;HIDKeyboardModifierMappingDst&lt;/key&gt;
            &lt;string&gt;30064771302&lt;/string&gt;
            &lt;key&gt;HIDKeyboardModifierMappingSrc&lt;/key&gt;
            &lt;string&gt;30064771303&lt;/string&gt;
        &lt;/dict&gt;
    &lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;


So the right way to update the setting is using XML format:

$ defaults -currentHost write -g com.apple.keyboard.modifiermapping.1452-591-0 -array \
'&lt;dict&gt;
    &lt;key&gt;HIDKeyboardModifierMappingDst&lt;/key&gt;
    &lt;integer&gt;30064771303&lt;/integer&gt;
    &lt;key&gt;HIDKeyboardModifierMappingSrc&lt;/key&gt;
    &lt;integer&gt;30064771302&lt;/integer&gt;
&lt;/dict&gt;' \
'&lt;dict&gt;
    &lt;key&gt;HIDKeyboardModifierMappingDst&lt;/key&gt;
    &lt;integer&gt;30064771302&lt;/integer&gt;
    &lt;key&gt;HIDKeyboardModifierMappingSrc&lt;/key&gt;
    &lt;integer&gt;30064771303&lt;/integer&gt;
&lt;/dict&gt;'