There isnt a real good way of doing this.
If you use this option, OA externally will still work given your using the same host name:
https://learn.microsoft.com/en-us/powershell/module/exchange/set-casmailbox?view=exchange-ps
-MAPIBlockOutlookExternalConnectivity
This parameter is available only in on-premises Exchange.
The MAPIBlockOutlookExternalConnectivity parameter enables or disables external access to the mailbox in Outlook by removing the external URLs from the Autodiscover response. This setting affects Outlook Anywhere, MAPI over HTTP, and Exchange Web Services (EWS). Valid values are:
$true: External Outlook clients can't use Outlook Anywhere, MAPI over HTTP, or EWS to access the mailbox.
$false: External Outlook clients can use Outlook Anywhere, MAPI over HTTP, or EWS to access the mailbox.
Note: If your organization uses the same Autodiscover URL values for internal and external clients, setting this parameter to $true won't block access for external clients.
You probably need to look at a reverse proxy solution instead and do not publish Outlook Anywhere externally:
https://www.petenetlive.com/KB/Article/0001548