Just change :

tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " SET download_count = '2' where orders_id = '" .


to :


tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " SET download_count = '".DOWNLOAD_MAX_COUNT."' where orders_id = '" .

More...