UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vpxOKstG58ck/VwmjOnyIZFrk/II6PdBYmRu96PmBPU=' 
WHERE 
  key_id = '9a7bcb0fe7353e6f41d7c65722f735e6e617f2309b1693aab5fd02ac3cbec0f1' 
  AND (
    token = 'vpxOKstG58ck/VwmjOnyIZFrk/II6PdBYmRu96PmBPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039