UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pi7C+EIIRwCFlglVjW/6RUZkOR3GGoyuo2uaTohVgyM=' 
WHERE 
  key_id = '16888f0bd248b3a7b5fcce211dcae2407f1943315ceae45209e177bfe7aff31c' 
  AND (
    token = 'pi7C+EIIRwCFlglVjW/6RUZkOR3GGoyuo2uaTohVgyM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017