UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QVN8Dj+Bs5/P9JJhtZMIf0jgJgTqjtUNZdOX9acDXVg=' 
WHERE 
  key_id = '9191edeed8c3da95428699bfa0e680c05a16bbe7f4be5a86aabb1ab7a6196516' 
  AND (
    token = 'QVN8Dj+Bs5/P9JJhtZMIf0jgJgTqjtUNZdOX9acDXVg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032