I would have used Gearman. This is the server of the organization and distribution of tasks, or simply put the message queue server.
Read about it, for example here
It will work like this:
The script is resorting to sending SMS:
# Connect to the server
$client= new GearmanClient();
# Register a task for background execution
# "sendsms" is the type of task
# $text is the letters
$result = $client->doBackground("sendmail", serialize($sms));
At this stage in turn will be added to your SMS and the script continues running, and as soon as one of the senders (of workarou in terminology Gearman) it will be delivered.
In this case, all the grunt work of storing the SMS in a queue, at priority send will take a third party app