UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e+DNImWmjeG6lxBKVQmXqulRXJ+MGUmSiwNgjYW8Tr4=' 
WHERE 
  key_id = '9171925a2055b3bd4abcbd43933e59b73c25c501e3dd62d07e03822dabe2a443' 
  AND (
    token = 'e+DNImWmjeG6lxBKVQmXqulRXJ+MGUmSiwNgjYW8Tr4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038