UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+pi8FEY5w30gd5fg6ijk8WmxO3FWA/V398NDEAiIHLo=' 
WHERE 
  key_id = '319278067a8682f16a34cd27083aa522f0507766cc34f0e137ffa8562db3044c' 
  AND (
    token = '+pi8FEY5w30gd5fg6ijk8WmxO3FWA/V398NDEAiIHLo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029