The error you're showing is from your PHP server, not Marketo. It results from a caught exception in a function you aren't showing here. So until you show the actual HTTP- or socket-level error from the Marketo connection it's impossible to confirm your experience.
In any case, the REST API rate limits are very clear: 100 calls per 20 seconds. So if you actually spaced your 100 calls out over 1 minute you wouldn't exceed them. But if the calls were packed into the first 20s of a minute, you would.
Could you please tell how can we queue these Marketo API calls or any other workaround for this?
You have to rate limit your outbound calls to Marketo. If you're getting too high a rate of inbound webhook requests to turn every one into an outbound API request, then in your code you need to make sure to end connections early if opening a resulting outbound PHP connection(s) to Marketo would cause you to go over the limit (and have retry logic in your Smart Campaign to reprocess people after a delay).
Also, when posting code here, please use the Advanced Editor's syntax highlighter, not a screenshot.
Other alternatives are to bulk deduplicate via Salesforce using a third-party app such as RingLead DMS. The ideal scenario is to prevent the duplicates in real-time, which can also be done via RingLead DMS on new records imported to Salesforce or created by users in Salesforce. RingLead also has a webhook that can clean up duplicates as they enter Marketo.