UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iMOsNedreH9JBF1qX7u9waiPNZt0MK7J8AKYqQdiMY4=' 
WHERE 
  key_id = 'a905aabb3af4186ed894fbf2fd542066404f7fd00bfdd7e1308933a826289f29' 
  AND (
    token = 'iMOsNedreH9JBF1qX7u9waiPNZt0MK7J8AKYqQdiMY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035