How to update option field in database on clicking the publish button in customizer

When ‘publish’ is clicked in customizer, the option ‘theme_mods_THEMENAMED’ is updated. An function/action could be added See https://developer.wordpress.org/reference/functions/add_action/ on the wordpress actions

add_option_(option_name) and

update_option_(option_name)

See https://codex.wordpress.org/Plugin_API/Action_Reference#Administrative_Actions. The new function could then save what ever option you want to update.