UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WyGn7x1x796VeABTkIaCg+8sv4ByzwNpg1vtknEEgc0=' 
WHERE 
  key_id = '88c4447f98eca534d25dfe6d5adcfc0f9271724cf6b2dedc5f62d716eb11b0b7' 
  AND (
    token = 'WyGn7x1x796VeABTkIaCg+8sv4ByzwNpg1vtknEEgc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028