UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iWZxAaNTcj5rRPoWC7uRvLj91fy5rfGqgdYxSeBVTqI=' 
WHERE 
  key_id = '6c27be752208be59b4ee80c9bd8253b751cd3f263388576546265a27ceb2d40c' 
  AND (
    token = 'iWZxAaNTcj5rRPoWC7uRvLj91fy5rfGqgdYxSeBVTqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017