Mysql How to update n rows using count function?
This query will update the oldest records that exceed the count of 500, so you keep 500 newest records for orgid = 1
update A 
set `delete` = true 
where orgid = 1 AND id IN (
SELECT id FROM  A where orgid = 1
order by createdate DESC
LIMIT 500,18446744073709551615);