UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U+njC4muFmuUSUu+xNjdjyPwnOHQ9eeWG85T69ufyPc=' 
WHERE 
  key_id = 'dbce81b579140dfabeb9a49899f529e601ea591885ff635f680003c20889500d' 
  AND (
    token = 'U+njC4muFmuUSUu+xNjdjyPwnOHQ9eeWG85T69ufyPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034