How to make a mysql statement for sent log I have a table called "make_sent_log"

CREATE TABLE IF NOT EXISTS `make_sent_log` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `transaction_id` varchar(255) NOT NULL,
    `total_base` int(11) NOT NULL,
    `delivered` int(11) NOT NULL,
    `pending` int(11) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `transaction_id` (`transaction_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;


My goal is store delivery status of mobile numbers 

For ex: sent bulk sms to 5 mobile Numbers 

one unique transaction id will generated then I store it to the transaction_id column ex:- transaction_id = trans_1

I sent sms to 5 Mobile Numbers so I store it to the total_base column
ex:- total_base = 5

If sms sent successfully to the only 3 Mobiles, delivered = 3

So other numbers in pending stage so pending = 2

So My table looks like 

INSERT INTO `make_sent_log` (`id`, `transaction_id`, `total_base`, `delivered`, `pending`) VALUES
(1, 'trans_1', 5, 3, 2);




My doubt is after some 1 or 2 Minutes, 2 pending numbers can be delivered so How to set 

delivered = 5


And pending = 0

See below image
In next iteration, you may need to check if there are pending numbers to send sms. If pending count is greater than zero then need to send sms to those pending numbers.

track success_count after resending sms to pending numbers.

Then, need to increment delivered count and decrement pending count with this success_count.

So, 

delivered  = delivered + success_count
pending = pending - success_count


then you may need to execute update on make_sent_log table with this updated delivered and pending counts.

update `make_sent_log` set delivered = delivered, pending = pending where transaction_id = 'trans_1';


Continue this iteration cycle until pending count = zero.