select 
    cast(round(avg(abs(timestampdiff(second,o.time,s.time)) ),0) as unsigned) as gap
from order_log o
join select_log s using (order_id)