UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I8f2Ni1gRg3UwijYBoMoKiImhIpCVDGB/YMjFR0pqZM=' 
WHERE 
  key_id = '92a1c42f39c4e12018aa9651810c4b6669401fb515247cb20bb17f35e0009bdc' 
  AND (
    token = 'I8f2Ni1gRg3UwijYBoMoKiImhIpCVDGB/YMjFR0pqZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037