UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aksf0B172v55pFspKqsGdLIvyEY1qXm4cEqMe+Yd7gM=' 
WHERE 
  key_id = '4ed2f068f8ba30234b8570f57a28b7d2f3d3b9f33fc8996716eea371d66936ee' 
  AND (
    token = 'aksf0B172v55pFspKqsGdLIvyEY1qXm4cEqMe+Yd7gM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036