Database Sync Script

We have a PHP script that loops and pulls inventory records using a CURL API to sync to a database using XPDO in command line. This PHP script is run through a system bash script on the server (I know, not the best but it is what I know). The issue we are having is, if the script is initiated prior to a new record being available via CURL any records that are added or updated will not insert or update. If the script is initiated after a record is available the script will function normally for the entire day. I could do a workaround where a log database table is updated on every loop but I’d rather find out why it is not accepting the records in this instance.