Hello,
It is a theme dependent question, different themes have different solutions for replacing search boxes.
If the theme use a widget for inserting the search box, then you can easily remove the original WordPress search widget and insert the Google Search widget instead.
Other themes use actions or filters or php templates for customizing the search box. For example in GeneratePress theme I have used ‘generate_inside_navigation’ action to change default WordPress search box to Custom Google searchbox. Inside the action the following PHP statement can be used:
echo do_shortcode('[wp_google_searchbox]');
I hope this information was helpful for you.
Please ask your site designer or the theme developer about the theme dependent possibilities.