create table t (
article_id int, id int
);
insert into t
values
(50, 1),
(50, 2),
(50, 3);
SELECT
if(id = max, min, id) as next
FROM
t,
(select max(id) as max, min(id) as min from t where article_id = 50) as m
WHERE article_id = 50
AND id > 2 LIMIT 1;