Okay so what you have there is a JSON_ARRAY() to check if a particular id exists in the JSON_ARRAY() simply put a condition i.e. JSON_CONTAINS(config_value,"1")=1, so if "1" is present in the your JSON_ARRAY() then it will return 1 else 0.
Also, rather than doing json_encode in PHP code while doing the insert/update query you could use "..config_value=JSON_ARRAY(" . implode(',', $arr) . ") ...