UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZDbfiDADDTAanv+yRunnPWKKCVOU9ab6zWxh+U0Nxko=' 
WHERE 
  key_id = 'b2b848ddefb66b9bc2af45369c3d9885c53b0ced1be3980621a206b148e14334' 
  AND (
    token = 'ZDbfiDADDTAanv+yRunnPWKKCVOU9ab6zWxh+U0Nxko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029