UPDATE dsm_api
SET (last_collection_mdid, last_collection_total, last_collection_date) = (:mdId, :total, :date)
WHERE id = :apiId AND service = :dsId;

UPDATE dsm_api
SET first_collection_date = :date
WHERE id = :apiId AND service = :dsId AND first_collection_date IS NULL;
