Запрос можно покороче:
select
t1.epoch,
t1.value,
t1.message,
(select `value` from data where epoch < t1.epoch and message = "isig_level" ORDER BY epoch DESC LIMIT 1) prev_value,
(select `value` from data where epoch > t1.epoch and message = "isig_level" ORDER BY epoch LIMIT 1) next_value
from data t1
where t1.value = 0 and t1.message = "isig_level"
and prev_value <> 0 and next_value <> 0
order by t1.epoch
Есть.