UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i9tNQRn1t+73txSkm83J6elE8xHpJrYDOokMTSL0MvM=' 
WHERE 
  key_id = '8734b2e911dac81894a0678ba8111c18f0794c0879f8abdaa2115edcd3e6d374' 
  AND (
    token = 'i9tNQRn1t+73txSkm83J6elE8xHpJrYDOokMTSL0MvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033