UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3V8iwULpyrX6JwHFPFKq77cC7YanToovWxce+o6m5SE=' 
WHERE 
  key_id = 'ac5eb91f4cc481bc3816e8677935879d148eeeac26321533da79e5541330199f' 
  AND (
    token = '3V8iwULpyrX6JwHFPFKq77cC7YanToovWxce+o6m5SE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031