UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y72fMfV6iGo4nVE+BEJ8wuaBsqtEDp2wVKSrbSQfNL4=' 
WHERE 
  key_id = '7da616d8c18812cffab4dd6d24d578268db9168080e132ede7ba71292422865a' 
  AND (
    token = 'Y72fMfV6iGo4nVE+BEJ8wuaBsqtEDp2wVKSrbSQfNL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035