Delete contacts from group
It's strongly recommended NOT to delete data directly via SQL.  I don't think it's possible to say which tables you need to delete from - there are hundreds of tables, not including those added by extensions, and it's impossible for us to know which are in use for you.

Instead, consider the suggestions by Jitendra and Aidan above - the issue is that the server is misconfigured.  Alternatively, consider using the API.  Especially if done from the command line where there should be no max_execution_time set, this should resolve your issue much more cleanly without causing orphan database records.