Batch update UCP groups?

I’ve added some groups in contact manager, and need to make all user see them in the UCP. I can do it manually in User Management and the contacts tab but it’s a lot of clicking!

I can see the values are stored in the userman_users_settings table, but the field is a blob and I can’t work out a valid UPDATE command.
Should be something like this:

UPDATE asterisk.userman_users_settings SET val = ["4","5","6","10","11","12","13","16","19","25","26","27"] where module = 'contactmanager' and `key` = 'groups'

but of course that is not a valid value. Any way to do it?