I encountered this error “Security code is not valid” when I tried to login into https://appleid.apple.com/account/manage to update my credit card info. The security code was reference to the 3 digit code at the back of the credit card.
Re-Type the credit card number and then save will fix the problem (hopefully) as in my case.
So what was the bug
I think what is buggy is if you select a previous credit card which had expired and want to update only expiration date etc, it will give this error. Simply do not select the previously loaded cards and start with enter new numbers. Hope it fixes the problem.