UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aBHAFBR38QaKoqOPvqval32ifu4jc3ea9MluQ1P8MBc=' 
WHERE 
  key_id = 'de34ddf2a7ce86fe666a2e15c1668ef5a9e2ebe1bb25500583161d63cbf704f9' 
  AND (
    token = 'aBHAFBR38QaKoqOPvqval32ifu4jc3ea9MluQ1P8MBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037