how to redirect 301 my old search query string to wordpress search query string?

Try something like the following at the top of your root .htaccess file (before the WordPress block):

RewriteCond %{QUERY_STRING} ^search=([^&]*)
RewriteRule ^cgi-bin/mt/mt-search\.cgi$ /?s=%1 [R=301,L]

%1 in the RewriteRule substitution is a backreference to the captured group in the preceding CondPattern (ie. the value of the search URL parameter – “WORDS”).

Clear your browser cache before testing.

It is preferable to first test with a 302 (temporary) redirect to avoid caching issues.

Reference:
https://httpd.apache.org/docs/current/mod/mod_rewrite.html

error code: 523