On a Mac OS X Yosemite and later choose Apple menu > System Preferences, then click iCloud.
Click Options next to Keychain.
Click Change Security Code and enter a new iCloud Security Code.
On other devices using iOS8+:
Choose Settings > iCloud > Keychain > Advanced.
Tap Change Security Code.