UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yOShrCsP1P9kJzlXlC21ObX/hioHPLK0J+tRt1G2NOM=' 
WHERE 
  key_id = 'b0e71a5eaedb62c9904c2cb052b1c76523ec84438578b2253b587a9115f3c8c5' 
  AND (
    token = 'yOShrCsP1P9kJzlXlC21ObX/hioHPLK0J+tRt1G2NOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038