UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VNMHgsz3Z0DmQa4D5cBvgyTwGvT2EJhwQp2c8kaT1Ag=' 
WHERE 
  key_id = 'e0d557be2f1d1975602039f082287669bef297d4eb5c7828d87dfed71120a78a' 
  AND (
    token = 'VNMHgsz3Z0DmQa4D5cBvgyTwGvT2EJhwQp2c8kaT1Ag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029