Your query doesn't seem wrong to me.
But note that you might also want to specify an order by
clause, to be sure which are the five "first" items :
update articles
set directory = 'art'
where directory = '0'
order by id
limit 5
Just as a reference : UPDATE Syntax