In changed_credentials, move the update of other records to db from code

For some reason, this is way faster on one client site with about 10K identities.