UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RynO6gfY/NY+h4AUdwkiObzlDS45YEPOV+uDhpm4hCg=' 
WHERE 
  key_id = '8ee00d7cc83281bf9e45a95397011b34468849470051f0d11f8bb9678ee6a72f' 
  AND (
    token = 'RynO6gfY/NY+h4AUdwkiObzlDS45YEPOV+uDhpm4hCg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024