I have build an apps with Codeigniter and want to make cron job and use MySQL
i have a table 'order' and have field like this
order_id | order_expired_date
001      | 2018-11-12 10:03:33
and i have table 'order_payment' like this,
order_id | op_status
001      | pending
I have many fields in these two tables but only include those that have something to do with this question
i have code from php but not in model codeigniter
$result = mysql_query('UPDATE `'order_payment'`
    SET op_status='expired' 
    WHERE
    (UNIX_TIMESTAMP( now( ) ) - `order_expired_date`));
The question is how to change the status in the order_payment table to expire when the expiration time is up?
 
     
    